/*
 * UniHash.h
 *
 *  Created on: Dec 4, 2014
 *      Author: ale
 */
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <map>
#include <sparsehash/sparse_hash_map>
#include "BiHash.h"
using namespace std;

#ifndef PRED_UNIHASH_H_
#define PRED_UNIHASH_H_

struct eqstr
{
  bool operator()(const char* s1, const char* s2) const
  {
    return (s1 == s2) || (s1 && s2 && strcmp(s1, s2) == 0);
  }
};

class UniHash {
public:
	UniHash(double prob, double backoff);
	virtual ~UniHash();

	bool agregarBigrama(const char* segunda_palabra, float prob, float boff);
	double obtenerProbabilidad(){return probabilidad;}
	double obtenerBackOff(){ return backoff;}

	google::sparse_hash_map<const char*, BiHash*, tr1::hash<const char*>, eqstr> *bigramas;

private:
	//Un hash con sus bigramas
	double probabilidad; //del unigrama
	double backoff; //del unigrama
};

#endif /* PRED_UNIHASH_H_ */
